menuMode
Type
property
Summary
Determines the appearance and behavior of menus associated with a button.
Syntax
set the menuMode of <button> to <menuType>
Description
Use the menuMode property to specify the appearance and behavior of the menu associated with a button.
Any button's contents can be viewed as a menu if the button's style property is set to "menu". The menuMode setting creates menus of different types from the button's contents. (You set the button's contents with the text property.)
You can also associate a stack with the button, using the menuName property. In this case, the contents of the stack's first card are displayed as a menu.
-
"pulldown": Displays each line of the button's contents as a menu item in a normal pulldown menu. Use this menuMode for buttons that are grouped into a menubar.
Setting a button's menuMode to "pulldown" has the same result as creating the equivalent menu items (as buttons) in a stack, then using the pulldown command to display the stack as a menu.
Note: On Mac OS and OS X systems, pulldown menus in a window are drawn by the standard operating system routines if the button's showBorder property is set to true and its borderWidth is not zero. Pulldown menus in the menu bar are always drawn by the operating system.
-
"cascade": Displays each line of the button's contents as a menu item in a hierarchical menu. (The button must be part of a stack menu.)
-
"popup": Displays each line of the button's contents as a menu item in a popup menu. The menu appears at the point of the mouse click.
Setting a button's menuMode to "popup" has the same result as creating the equivalent menu items (as buttons) in a stack, then using the popup command to display the stack as a menu.
-
"tabbed": Displays the button's contents as a horizontal list of tabs, like the tabs on file folders. Each line of the button's contents is the title of a tab. Usually, tabbed buttons are used for dialog boxes or palettes containing a different group of controls for each tab. You can handle the menuPick message to display the correct group when a tab is clicked:
on menuPick newTab,oldTab -- sent when user clicks a tab
lock screen -- hide the swap
hide group oldTab
show group newTab
unlock screen
end menuPick
-
"comboBox": Displays the button's contents as a drop-down scrolling list, with an editable field at the top.
Note: If a button's menuMode is set to "comboBox", the button receives field messages. For example, when the user clicks in the editable field, an openField message is sent to the button.
-
"option": Displays an option menu (when the lookAndFeel property is set to "Motif"), a drop-down list (when the lookAndFeel property is set to "Windows 95" ), or a Mac-style popup menu (when the lookAndFeel property is set to "Appearance Manager" or "Macintosh" ). Setting a button's menuMode to option has the same result as creating the equivalent menu items (as buttons) in a stack, then using the option command to display the stack as a menu.
Regardless of the menuMode, a menuPick message is sent to the button when the user chooses a menu item from the menu.
If the button's style property is not set to "menu", the setting of its menuMode property has no effect.
Examples
set the menuMode of button "Edit" to pulldown
Related
property: menuLines, showBorder, menuName, menubar, borderWidth, lookAndFeel, titleWidth
command: pulldown, option, group, popup
glossary: popup menu, stack menu, appearance, field, cascading menu, line, property, command, tabbed button, behavior, handle, palette, message, Mac OS, OS X, control, dialog box, menu bar, menu, point, menu item, card
keyword: file, button, text, popup
Compatibility and Support
Introduced
LiveCode 1.0
OS
mac
windows
linux
Platforms
desktop
server